<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<!-- http://localhost:8080/atcrowdfunding02-admin-webui/test/ssm.html -->
<base
	href="http://${pageContext.request.serverName }:${pageContext.request.serverPort }${pageContext.request.contextPath }/" />
<script type="text/javascript" src="jquery/jquery-2.1.1.min.js"></script>

</head>
<body>

	<a href="test/ssm.html">测试SSM整合环境</a>
	<br/>
	<br/>
	<button id="btn4">发送请求</button>

</body>
<script type="text/javascript">

	$(function() {
		$("#btn4").click(function() {
			// 准备要发送的数据
			var student = {
				"stuId" : 1,
				"stuName" : "jared",
				"address" : {
					"province" : "北京",
					"city" : "北京",
					"street" : "后端"
				},
				"subjectList" : [ {
					"subjectName" : "JavaSE",
					"subjectScore" : 100
				}, {
					"subjectName" : "SSM",
					"subjectScore" : 99
				} ],
				"map" : {
					"k1" : "v1",
					"k2" : "v2"
				}
			};

			// 将JSON对象转换为JSON字符串
			var requestBody = JSON.stringify(student);

			// 发送Ajax请求
			$.ajax({
				"url" : "send/compose/object.json",
				"type" : "post",
				"data" : requestBody,
				"contentType" : "application/json;charset=UTF-8",
				"dataType" : "json",
				"success" : function(response) {
					console.log('请求成功',response);
				},
				"error" : function(response) {
					console.log('请求失败',response);
				}
			});

		});
	})
</script>
</html>